import { PORT3 } from '@/api/config/servicePort';
import http from '@/api';
import { PublicParams } from '@/api/interface/publicParams';
import { DeptInterface } from '@/api/interface/dept/dept';
/**
 * @name 部门
 */
/** 新增|编辑 */
export const deptSave = (params: DeptInterface.ReqSave) => {
  return http.post(PORT3 + `/dept/v1/save`, params);
};
/**获取树结构部门 */
export const deptListByTree = (params?: DeptInterface.ReqList) => {
  return http.post<DeptInterface.ResListByTree[]>(PORT3 + `/dept/v1/listByTree`, params);
};
/**修改状态 */
export const deptChangeStatus = (params: PublicParams.ReqStatus) => {
  return http.post(PORT3 + `/dept/v1/changeStatus`, params);
};

/**获取平铺树结构 */
export const deptListByFlattenTree = (params: DeptInterface.ReqList) => {
  return http.post<DeptInterface.ResListByTree[]>(PORT3 + `/dept/v1/ListByFlattenTree`, params);
};
/**获取部门以及部门下岗位 */
export const deptListFindByDeptAndPosition = () => {
  return http.get<DeptInterface.ResListByTreeByPosition[]>(PORT3 + `/dept/v1/listFindByDeptAndPosition`);
};
/**删除 */
export const deptDelete = (params: PublicParams.ReqId) => {
  return http.get(PORT3 + `/dept/v1/delete/${params.id}`);
};
